interface Remote {
    fun up()
    fun down()
    fun doubleUp() {
        up()
        up()
    }
    companion object {
        fun combine(first: Remote, second: Remote): Remote = object : Remote {
            override fun up() {
                first.up()
                second.up()
            }

            override fun down() {
                first.down()
                second.down()
            }
        }
    }
}


class TV{
    private var volume = 0
    val remote:Remote
    get() = TVRemote()

    override fun toString(): String {
        return "Volume:${volume}"
    }
    inner class TVRemote:Remote{
        override fun down() {
            volume --
        }

        override fun up() {
            volume ++
        }

        override fun toString(): String {
            return "Remote:${this@TV.toString()}"
        }
    }
}

val Tv = TV()
val remote = Tv.remote

println("$Tv")
remote.up()
println("After increase:$Tv")
remote.down()
println("After decrease:$Tv")